import { getMedicalOrderDetailAPI } from "@/apis/medicalorder"
import type { OrderDetail } from "@/types/medicalorder"
import { onMounted, ref } from "vue"

export const useOrderDetail = (id: string) => {
  const loading = ref(false)
  const orderdetail = ref<OrderDetail>()
  onMounted(async () => {
    loading.value = true
    try {
      const res = await getMedicalOrderDetailAPI(id)
      orderdetail.value = res.data
    } finally {
      loading.value = false
    }
  })
  return { orderdetail, loading }
}